package server;

public abstract class HttpServlet implements Servlet {

    public abstract void doGet(Request request, Response response) throws Exception;
    public abstract void doPost(Request request, Response response) throws Exception;



    @Override
    public void service(Request request, Response response) throws Exception {

        if(request.getMethod().equalsIgnoreCase("get")) {
            this.doGet(request, response);
        } else if (request.getMethod().equalsIgnoreCase("post")) {
            this.doPost(request, response);
        } else {
            throw new Exception(" The request method does not supported !!");
        }
    }

}
